package com.xxl.job.admin.service.impl;

import com.xxl.job.admin.dao.RecordDao;
import com.xxl.job.admin.dto.CronJobModificationRecordDto;
import com.xxl.job.admin.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wenhonghao
 * @email 18167784149@163.com
 * @description: 查看修改记录
 */
@Service
public class RecordServiceImpl implements RecordService {
    @Autowired
    private RecordDao recordDao;

    @Override
    public List<CronJobModificationRecordDto> getCronJobAuditLogs(String serverIp, String jobDesc, String modifiedBy, String command, int page, int size) {
        int offset = (page - 1) * size;
        return recordDao.findCronJobAuditLogs(serverIp, jobDesc, modifiedBy, command, offset, size);
    }

    @Override
    public int getTotalCount(String serverIp, String jobDesc, String modifiedBy, String command) {
        return recordDao.countCronJobAuditLogs(serverIp, jobDesc, modifiedBy, command);
    }
}
